public class Test {

    public static void main(String[] args) {
    int[] nums = {0,1,2,2,3,0,4,2};
    int val = 0;
    Test test = new Test();

       System.out.println("nums : "+test.removeElement(nums, 2));
    }
   public int removeElement(int[] nums, int val) {
               if(nums.length == 0){
                   return 0;
               }
               int slow = 0, fast = 0;
               while(fast < nums.length){
                   if(nums[fast] != val){
                       nums[slow] = nums[fast];
                       slow++;
                   }
                   fast++;
               }
       for (int i = 0; i < nums.length; i++) {
           System.out.println(nums[i]);
       }

               return slow;
           }
       }


